<template>
  <div id="app">
    <div class="page-header col-xs-offset-2 col-xs-8">
      <h2>Vue路由测试</h2>
    </div>
    <!-- 导航区域 -->
    <!-- 声明式路由导航 -->
    <!-- active-class="cur"  可以给当前点击的导航添加对应的样式 -->
    <div class="col-xs-2 col-xs-offset-2">
      <router-link class="list-group-item" to="/about" active-class="cur"
        >About</router-link
      >
      <router-link class="list-group-item" to="/home" active-class="cur"
        >Home</router-link
      >
    </div>
    <!-- 展示区 -->
    <!-- 路由组件展示的地方 -->
    <!-- keep-alive 用来缓存路由组件，让组件每次切换不会被销毁重建 -->
    <!-- <keep-alive>  全部缓存路由组件 -->
    <keep-alive :include="['About']">
      <!--缓存指定路由组件  -->
      <router-view class="col-xs-6 panel-body"></router-view>
    </keep-alive>
  </div>
</template>

<script>
export default {
  name: "App",
  components: {},
};
</script>

<style>
/* 要想在组件中使用less样式 需要下载 less，less-loader (npm i less less-loader)*/
/* 然后在style标签添加 lang='less'*/
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.cur {
  background: rgb(21, 138, 210) !important;
}
ul{
  list-style: none;
}
</style>
